<h2>Sitemap</h2>
<?php 
if($categories){
foreach ($categories as $cat){?>
<h3><?php echo anchor("codingfrenzy/category/$cat->category_id/$cat->category_name/",$cat->category_name);?></h3>
<ul>
	<?php foreach ($records as $row){
	if($row->entry_category_parent == $cat->category_id){
		?>
  	<li> <?php echo $row->entry_date;?>  <?php echo anchor("codingfrenzy/entry/$row->entry_name/$row->entry_id",$row->entry_name);?></li>
  	<?php }
	}?>
</ul>

<?php }

}?>

<?php foreach ($records as $rec){?>
<ul>
<?php if($rec->entry_category_parent == 1){?>
<li> <?php echo $rec->entry_date;?>  <?php echo anchor("codingfrenzy/entry/$rec->entry_id/$rec->entry_name/$rec->entry_id",$rec->entry_name);?></li>
<?php }?>
</ul>
<?php }?>